package com.itdct.onflow.system.api.listener

import com.itdct.onflow.system.api.manager.SysApiManager
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.ApplicationListener
import org.springframework.context.event.ContextRefreshedEvent
import org.springframework.stereotype.Component

/**
 * @author Zhouwx
 * @date 2025/9/5 14:10:19
 * @version 1.0
 * @description
 */
@ConditionalOnProperty(name = ["onflow.check-permission"], havingValue = "true")
@Component
class ApiRoleInitListener(
    val sysApiManager: SysApiManager
) : ApplicationListener<ContextRefreshedEvent> {
    override fun onApplicationEvent(event: ContextRefreshedEvent) {
        sysApiManager.refreshRoleApi()
    }

}